* July 5, 2021
version 16.1

*******************
* Clear Utilities *
*******************

adopath ++ Utilities

capture program drop addplot
capture program drop balplot_cat
capture program drop coefplot
capture program drop fx1
capture program drop fx1_byff
capture program drop fx1_byhc
capture program drop fx1_byparty
capture program drop fx2
capture program drop fx2_byparty
capture program drop incent
capture program drop incent_byparty
capture program drop levels2
capture program drop levels2_byff
capture program drop levels2_byhc
capture program drop levels2_byparty
capture program drop mkwts3

*************
* Load Data *
*************

use ../../2018-09-08-Shame/Output/prepped_wave1and2, clear
append using ../../2018-10-07-ShameReply/Output/prepped_wave4
append using ../../2018-10-17-Shame/Output/prepped_wave5
append using ../../2021-01-02-WhoShames/Output/prepped_wave6

*****************
* Update Labels *
*****************

label define pid3 1 "Democrats" 2 "Independents" 3 "Republicans", replace
tab pid3

label define axn5 0 "No Action" 1 "Cut 5%, Cost 10%" 2 "Cut 5%, Cost 4%" ///
   3 "Cut 25%, Cost 10%" 4 "Cut 25%, Cost 4%", replace
tab axn5

label drop shamed
label define shamed 0 "No Shaming" 1 "Shaming" ///
   3 "Shaming + Defiance" 4 "Shaming + Contrition" 5 "No Shaming 2021" ///
	6 "Many Countries" 7 "Allies" 8 "Non-Allies" 9 "Allies + Non-Allies"
label values shamed shamed
tab shamed wave

***********************************
* Additional Treatment Indicators *
***********************************

forvalues i = 0/1 {
	gen byte shamed`i' = cond(shamed==`i',1,0)
}
label var shamed0 "No Shaming"
label var shamed1 "Shaming"
recode shamed 1=1 0=0 *=., gen(shamed_1v0)  // shamed vs not
recode shamed 3=1 0=0 *=., gen(shamed_3v0)  // (shame+defiance) v no shaming
recode shamed 4=1 0=0 *=., gen(shamed_4v0)  // (shame+contrition) v no shaming

*************************
* Attentive respondents *
*************************

tempfile all_resp
save `all_resp'  // all respondents, whether passed or not (for use later)
keep if attn_passed == 1

bysort shamed: tab axn5 pid3

* Create Party Weights and balance over cost conditions
* For each type of shaming and each of 3 levels of action, party ID of 
* respondent should be balanced, and cost of action should be balanced
* Party weights from Pew Sept 2018: 32.7% Dem, 41.8 Ind/Other/NoPref, 25.5% Rep
mkwts3, wt1(.327) wt2(.418) wtvar(wt5)

* Confirm that, after weighting, conditions are balanced with respect to
* pid3 (32.7% Dem, 41.8% Ind, 25.5% Rep) and cost (50% low, 50% high)
bysort shamed axn3: tab pid3 [aweight=wt5]
bysort shamed axn3: tab axn5 [aweight=wt5]

* summarize and set weights
tab wt5
svyset [pweight=wt5]

*********************
* Descriptive stats *
*********************
if 1 {

	capture log close
	log using ../Output/descriptive_stats.txt, text replace nomsg

	* gender
	tab male [aweight=wt5]

	* age
	recode age 18/24=1 25/44=2 45/64=3 *=4, gen(agecat)
	label define agecat 1 "18-24" 2 "25-44" 3 "45-64" 4 "65+"
	label values agecat agecat
	tab agecat [aweight=wt5]

	* region
	tab region [aweight=wt5]

	* race
	gen race = white + 2*black + 3*(1-white-black)
	label define race 1 "White" 2 "Black" 3 "Other"
	label values race race
	tab race [aweight=wt5]

	* education
	recode ed4 1=1 2=2 3/4=3, gen(ed3)
	label define ed3 1 "HS or less" 2 "Some college" 3 "BA"
	label values ed3 ed3
	tab ed3 [aweight=wt5]

	* party
	tab pid3 [aweight=wt5]

	* Humans causing climate change
	tab hc2 [aweight=wt5]

	* Regulate fossil fuels
	tab ff2 [aweight=wt5]

	* Sample sizes overall and by experiment
	recode shamed 0/1=1 3=3 4=2 5/9=4, gen(expt)
	label define expt 1 "Shaming" 2 "Contrition" 3 "Defiance" 4 "Shamers"
	label values expt expt
	label var expt "Experiment Number"
	tab expt // unweighted
	tab expt [aweight=wt5] // weighted 
	tab expt if expt ~= 4  // sum of observations from 2018
	tab expt if expt ~= 4 [aweight=wt5] // weighted 
	bysort expt: tab axn3 shamed
	bysort expt: tab axn3 shamed [aweight=wt5]

	log close

}

*****************
* Balance tests *
*****************
if 1 {

	* build list of treatment labels
	egen t = group(axn3 shamed)
	tab t
	forvalues t = 1/17 { 
		su axn3 if t==`t', meanonly
		local a `r(min)'
		su shamed if t==`t', meanonly
		local s `r(min)'
		local tlabels `tlabels' a`a'_s`s' // build list of treatment labels	
	}		
	local bonf bonf(17)
	
	* gender
	local gopts aspect(2.2) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+45)) ///
		subtitle(, fcolor(white) margin(t+1))	
	balplot_cat male [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1(Male) cat2(0) title2(Female)	
	graph export ../Output/Appendix_Figure_01.pdf, replace
	graph export ../Output/Appendix_Figure_01.emf, replace

	* age
	local gopts aspect(3.4) mlabpos(2) msymbol(oh) ///
		xtitle("Percent", size(3) margin(l+37)) ///
		subtitle(, fcolor(white) margin(t+1)) xlabel(0(50)100)
	balplot_cat agecat [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("Age 18-24") cat2(2) title2("Age 25-44") cat3(3) ///
		title3("Age 45-64") cat4(4) title4("Age 65+") byopts(rows(1) iscale(.7))
	graph export ../Output/Appendix_Figure_02.pdf, replace
	graph export ../Output/Appendix_Figure_02.emf, replace

	* region
	local gopts aspect(3.4) mlabpos(2) msymbol(oh) ///
		xtitle("Percent", size(3) margin(l+37)) ///
		subtitle(, fcolor(white) margin(t+1)) xlabel(0(50)100)
	balplot_cat region [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(2) title1("Midwest") cat2(1) title2("Northeast") cat3(3) ///
		title3("South") cat4(4) title4("West") byopts(rows(1) iscale(.7))
	graph export ../Output/Appendix_Figure_03.pdf, replace
	graph export ../Output/Appendix_Figure_03.emf, replace

	* race
	local gopts aspect(3.4) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+46)) ///
		subtitle(, fcolor(white) margin(t+1)) xlabel(0(50)100)
	balplot_cat race [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("White") cat2(2) title2("Black") cat3(3) ///
		title3("Other") byopts(rows(1))
	graph export ../Output/Appendix_Figure_04.pdf, replace
	graph export ../Output/Appendix_Figure_04.emf, replace

	* education
	local gopts aspect(3.4) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+46)) ///
		subtitle(, fcolor(white) margin(t+1)) xlabel(0(50)100)
	balplot_cat ed3 [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("HS or Less") cat2(2) title2("Some College") cat3(3) ///
		title3("Bachelor's") byopts(rows(1))
	graph export ../Output/Appendix_Figure_05.pdf, replace
	graph export ../Output/Appendix_Figure_05.emf, replace

	* party
	local gopts aspect(3.4) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+46)) ///
		subtitle(, fcolor(white) margin(t+1)) xlabel(0(50)100)
	balplot_cat pid3 [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("Democrat") cat2(2) title2("Independent") cat3(3) ///
		title3("Republican") byopts(rows(1))
	graph export ../Output/Appendix_Figure_06.pdf, replace
	graph export ../Output/Appendix_Figure_06.emf, replace

	* humans causing climate change
	local gopts aspect(2.2) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+45)) ///
		subtitle(, fcolor(white) margin(t+1))	
	balplot_cat hc2 [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("Humans Causing") cat2(0) title2("Not Causing or DK")	
	graph export ../Output/Appendix_Figure_07.pdf, replace
	graph export ../Output/Appendix_Figure_07.emf, replace

	* pass laws to reduce use of fossil fuels
	local gopts aspect(2.2) mlabpos(2) msymbol(o) ///
		xtitle("Percent", size(3) margin(l+45)) ///
		subtitle(, fcolor(white) margin(t+1))	
	balplot_cat ff2 [pweight=wt5], tlabels(`tlabels') gopts(`gopts') `bonf' ///
		cat1(1) title1("Favor New Laws") cat2(0) title2("Oppose New Laws")	
	graph export ../Output/Appendix_Figure_08.pdf, replace
	graph export ../Output/Appendix_Figure_08.emf, replace
	
}

*************************************
* Approval without and with shaming *
*************************************
if 1 {

   * Binary
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(t+2)) aspect(1) scale(1.7)
	levels2 a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) ///
		opts(`opts' /* legend(rows(2) position(12)) */  )
	graph export ../Output/Fig_01.emf, replace
	graph export ../Output/Fig_01.pdf, replace
	
	* 5-point scale
	local opts xlabel(0(20)100) xtitle("Approval (Scale)", margin(t+2)) aspect(1) scale(1.7)
	levels2 a_overall [pweight=wt5], gp1(shamed0) gp2(shamed1) ///
		opts(`opts' /* legend(rows(2) position(12)) */  )
	graph export ../Output/Appendix_Figure_10.emf, replace
	graph export ../Output/Appendix_Figure_10.pdf, replace

	* Binary, by Party
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7)
	levels2_byparty a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) opts(`opts')
	graph export ../Output/Fig_03.emf, replace
	graph export ../Output/Fig_03.pdf, replace
	
	* 5-point scale, by Party
	local opts xlabel(0(20)100) xtitle("Approval (Scale)", margin(l+18)) aspect(1) scale(1.7)
	levels2_byparty a_overall [pweight=wt5], gp1(shamed0) gp2(shamed1) opts(`opts')
	graph export ../Output/Appendix_Figure_13.emf, replace
	graph export ../Output/Appendix_Figure_13.pdf, replace
	
	* Binary, by Climate Beliefs
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7)
	levels2_byhc a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) opts(`opts')
	graph export ../Output/Appendix_Figure_22.emf, replace
	graph export ../Output/Appendix_Figure_22.pdf, replace
		
	* Binary, by Climate Beliefs and Party
	tab pid3 hc2 [aweight=wt5], row	
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7) name(g1, replace)
	levels2_byparty a_overall2 [pweight=wt5] if hc2==1, gp1(shamed0) gp2(shamed1) opts(`opts') byopts(title(Humans Causing, margin(l+18)))		
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7) name(g2, replace)
	levels2_byparty a_overall2 [pweight=wt5] if hc2==0, gp1(shamed0) gp2(shamed1) opts(`opts') byopts(title(Humans Not Causing or DK, margin(l+18)))
	graph combine g1 g2, plotregion(style(none)) scheme(s1mono) cols(1)
	graph export ../Output/Appendix_Figure_24.emf, replace
	graph export ../Output/Appendix_Figure_24.pdf, replace
	
	* Binary, by Policy Preferences
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7)
	levels2_byff a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) opts(`opts')
	graph export ../Output/Appendix_Figure_26.emf, replace
	graph export ../Output/Appendix_Figure_26.pdf, replace	

	* Binary, by Policy Preferences and Party
	tab pid3 hc2 [aweight=wt5], row	
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7) name(g1, replace)
	levels2_byparty a_overall2 [pweight=wt5] if ff2==1, gp1(shamed0) gp2(shamed1) opts(`opts') byopts(title(Favor New Laws, margin(l+18)))	
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7) name(g2, replace)
	levels2_byparty a_overall2 [pweight=wt5] if ff2==0, gp1(shamed0) gp2(shamed1) opts(`opts') byopts(title(Oppose New Laws, margin(l+18)))
	graph combine g1 g2, plotregion(style(none)) scheme(s1mono) cols(1)
	graph export ../Output/Appendix_Figure_28.emf, replace
	graph export ../Output/Appendix_Figure_28.pdf, replace	
		
}

**********************************
* Effects of shaming on approval *
**********************************
if 1 {

   * Binary
   local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)
   fx1 a_overall2 [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_09.emf, replace
	graph export ../Output/Appendix_Figure_09.pdf, replace

	* 5-point scale
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (Scale)", margin(t+2)) aspect(.6) scale(1.5)
   fx1 a_overall [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_11.emf, replace
	graph export ../Output/Appendix_Figure_11.pdf, replace

   * Binary, by Party
   local opts xlabel(-40(20)20) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5)
   fx1_byparty a_overall2 [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_17.emf, replace
	graph export ../Output/Appendix_Figure_17.pdf, replace

	* Binary, by Climate Beliefs
	local opts xlabel(-40(20)20) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5)
   fx1_byhc a_overall2 [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_23.emf, replace
	graph export ../Output/Appendix_Figure_23.pdf, replace

	* Binary, by Climate Beliefs and Party
	local opts xlabel(-60(30)60) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5) name(g1, replace)
   fx1_byparty a_overall2 [pweight=wt5] if hc2==1, t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts') byopts(title(Humans Causing, margin(l+18)))		
	local opts xlabel(-60(30)60) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5) name(g2, replace)
   fx1_byparty a_overall2 [pweight=wt5] if hc2==0, t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts') byopts(title(Humans Not Causing or DK, margin(l+18)))
	graph combine g1 g2, plotregion(style(none)) scheme(s1mono) cols(1)
	graph export ../Output/Appendix_Figure_25.emf, replace
	graph export ../Output/Appendix_Figure_25.pdf, replace
	
	* Binary, by Policy Preferences		
	local opts xlabel(-40(20)20) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5)
   fx1_byff a_overall2 [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_27.emf, replace
	graph export ../Output/Appendix_Figure_27.pdf, replace
	
	* Binary, by Policy Preferences and Party
	local opts xlabel(-60(30)60) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5) name(g1, replace)
   fx1_byparty a_overall2 [pweight=wt5] if ff2==1, t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts') byopts(title(Favor New Laws, margin(l+18)))		
	local opts xlabel(-60(30)60) xtitle("Effect on Approval (%)", margin(l+16)) aspect(.6) scale(1.5) name(g2, replace)
   fx1_byparty a_overall2 [pweight=wt5] if ff2==0, t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts') byopts(title(Oppose New Laws, margin(l+18)))
	graph combine g1 g2, plotregion(style(none)) scheme(s1mono) cols(1)
	graph export ../Output/Appendix_Figure_29.emf, replace
	graph export ../Output/Appendix_Figure_29.pdf, replace
	
}

*********************************************************
* Incentive to comply (increase from Cut 5% to Cut 25%) *
*********************************************************
if 1 {
	
	* Binary
	incent a_overall2 [pweight=wt5], ///
		opts(xlabel(0(10)40) xtitle("Incentive (%)") aspect(.5) scale(1.5))		
	graph export ../Output/Fig_02.emf, replace
	graph export ../Output/Fig_02.pdf, replace
	
	* 5-point scale
	incent a_overall [pweight=wt5], ///
		opts(xlabel(0(10)40) xtitle("Incentive (Scale)") aspect(.5) scale(1.5))		
	graph export ../Output/Appendix_Figure_12.emf, replace
	graph export ../Output/Appendix_Figure_12.pdf, replace
	
   * By party
	incent_byparty a_overall2 [pweight=wt5], opts(xlabel(0(25)50) ///
	   xtitle("Incentive (%)", margin(l+23)) aspect(.5) scale(1.5))
	graph export ../Output/Appendix_Figure_18.emf, replace
	graph export ../Output/Appendix_Figure_18.pdf, replace
	
}

*************************************************
* Approval: None, Shaming, Shaming + Contrition *
*************************************************
if 1 {
   
	* effects of shaming (solid) and shaming with defiance (hollow)
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_4v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')	
	graph export ../Output/Fig_04.emf, replace
	graph export ../Output/Fig_04.pdf, replace
	
	* same, but 5 point scale
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (Scale)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall [pw=wt5], t1(shamed_1v0) t2(shamed_4v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')	
	graph export ../Output/Appendix_Figure_14.emf, replace
	graph export ../Output/Appendix_Figure_14.pdf, replace
	
	* effects of shaming (solid) and shaming with defiance (hollow), by party
	local opts xlabel(-60(30)30) xtitle("Effect on Approval (%)", margin(l+18)) aspect(1.4) scale(1.5)
   fx2_byparty a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_4v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Appendix_Figure_19.emf, replace
   graph export ../Output/Appendix_Figure_19.pdf, replace
		
}	

***********************************************
* Approval: None, Shaming, Shaming + Defiance *
***********************************************
if 1 {
   
	* effects of shaming (solid) and shaming with defiance (hollow)
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_3v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Fig_05.emf, replace
	graph export ../Output/Fig_05.pdf, replace
	
	* same but 5 point scale	
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (Scale)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall [pw=wt5], t1(shamed_1v0) t2(shamed_3v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Appendix_Figure_15.emf, replace
	graph export ../Output/Appendix_Figure_15.pdf, replace
	
	* effects of shaming (solid) and shaming with defiance (hollow), by party
	local opts xlabel(-60(30)30) xtitle("Effect on Approval (%)", margin(l+18)) aspect(1.4) scale(1.5)
   fx2_byparty a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_3v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Appendix_Figure_20.emf, replace
   graph export ../Output/Appendix_Figure_20.pdf, replace
	
}	
	
*********************************************
* Effects of shaming on approval, by shamer *
*********************************************
if 1 {

	* Binary
	reg a_overall2 i.shamed [pw=wt5] if inlist(shamed,5,6,7,8,9), robust
	margins i.shamed
	margins r.shamed
	matrix fx = r(table)
	coefplot matrix(fx[1,]), ci((fx[5,] fx[6,])) plotregion(style(none)) scheme(s1mono) ///
		mlabel mlabpos(10) format(%3.0f) xlabel(-30(10)0) ///		
		coeflabel(r6vs5.shamed = "Many Countries" r7vs5.shamed = "Allies Only" ///
			r8vs5.shamed = "Non-Allies Only" r9vs5.shamed = "Allies & Non-Allies") ///		
		xline(0, lpattern(dash)) ///
		xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.3)
	graph export ../Output/Fig_06.emf, replace
	graph export ../Output/Fig_06.pdf, replace

	* 5-point Scale
	reg a_overall i.shamed [pw=wt5] if inlist(shamed,5,6,7,8,9), robust
	margins i.shamed
	margins r.shamed
	matrix fx = r(table)
	coefplot matrix(fx[1,]), ci((fx[5,] fx[6,])) plotregion(style(none)) scheme(s1mono) ///
		mlabel mlabpos(10) format(%3.0f) xlabel(-20(10)0) ///		
		coeflabel(r6vs5.shamed = "Many Countries" r7vs5.shamed = "Allies Only" ///
			r8vs5.shamed = "Non-Allies Only" r9vs5.shamed = "Allies & Non-Allies") ///		
		xline(0, lpattern(dash)) ///
		xtitle("Effect on Approval (Scale)", margin(t+2)) aspect(.6) scale(1.3)
	graph export ../Output/Appendix_Figure_16.emf, replace
   graph export ../Output/Appendix_Figure_16.pdf, replace

	* Binary, By Party
	tempname fx1 fx2 fx3
   forvalues p = 1/3 {
	   reg a_overall i.shamed [pw=wt5] if inlist(shamed,5,6,7,8,9) & pid3==`p', robust
		margins i.shamed // for reference
	   margins r.shamed
	   matrix `fx`p'' = r(table)
   }
	* combine 3 plots horizontally
	local gopts scheme(s1mono) plotregion(style(none) margin(t+2 b+2)) mlabel format(%3.0f)
	local opts xlabel(-40(20)20) xtitle("Effect on Approval (%)", margin(l+28)) aspect(.8) scale(1.5)
   coefplot (matrix(`fx1'[1,]), ci("`fx1'[5,] `fx1'[6,]") msymbol(O) mlabpos(10)), bylabel(Democrats) ///
	   ||  ///
		(matrix(`fx2'[1,]), ci("`fx2'[5,] `fx2'[6,]") msymbol(O) mlabpos(10)), bylabel(Independents) ///
		|| ///
		(matrix(`fx3'[1,]), ci("`fx3'[5,] `fx3'[6,]") msymbol(O) mlabpos(10)), bylabel(Republicans) ///
		coeflabel(r6vs5.shamed = "Many Countries" r7vs5.shamed = "Allies Only" ///
			r8vs5.shamed = "Non-Allies Only" r9vs5.shamed = "Allies & Non-Allies") ///	
		xline(0, lpattern(dash)) ///			
		byopts(rows(1) legend(off)) subtitle(, fcolor(white)) `gopts' `opts'
	graph export ../Output/Appendix_Figure_21.emf, replace
   graph export ../Output/Appendix_Figure_21.pdf, replace
	
}

***********************************
* Include Inattentive Respondents *
***********************************
if 1 {
   
	* load data and report sample sizes
	use `all_resp', clear
	recode shamed 0/1=1 /*2=2*/ 3=3 4=2 5/9=4, gen(expt)
   label define expt 1 "Shaming" 2 "Contrition" 3 "Defiance" 4 "Shamers"
   label var expt "Experiment Number"
   tab expt attn_passed, row
	
	* create weights
	bysort shamed: tab axn5 pid3
	mkwts3, wt1(.327) wt2(.418) wtvar(wt5)
	bysort shamed axn3: tab pid3 [aweight=wt5]
	bysort shamed axn3: tab axn5 [aweight=wt5]
	svyset [pweight=wt5]

   * Approval of U.S. Policy without Shaming and with Shaming   
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(t+2)) aspect(1) scale(1.7)
	levels2 a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) ///
		opts(`opts' /* legend(rows(2) position(12)) */  )
	graph export ../Output/Appendix_Figure_30.emf, replace
   graph export ../Output/Appendix_Figure_30.pdf, replace
	
   * Effects of Shaming on Approval
   local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)
   fx1 a_overall2 [pweight=wt5], t1(shamed_1v0) opts(xline(0, lpattern(dash)) `opts')
	graph export ../Output/Appendix_Figure_31.emf, replace
   graph export ../Output/Appendix_Figure_31.pdf, replace
	
   * Political Incentive to Comply without and with shaming
	incent a_overall2 [pweight=wt5], ///
		opts(xlabel(0(10)40) xtitle("Incentive (%)") aspect(.5) scale(1.5))		
	graph export ../Output/Appendix_Figure_32.emf, replace
   graph export ../Output/Appendix_Figure_32.pdf, replace
	
   * Approval of U.S. Policy without Shaming and with Shaming, by Party
	local opts xlabel(0(20)100) xtitle("Approval (%)", margin(l+18)) aspect(1) scale(1.7)
	levels2_byparty a_overall2 [pweight=wt5], gp1(shamed0) gp2(shamed1) opts(`opts')
	graph export ../Output/Appendix_Figure_33.emf, replace
   graph export ../Output/Appendix_Figure_33.pdf, replace
	
	* Figure A34: Effects of Shaming Without a Rebuttal and with Contrition
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_4v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Appendix_Figure_34.emf, replace
   graph export ../Output/Appendix_Figure_34.pdf, replace
	
   * Effects of Shaming Without a Rebuttal and with Defiance
	local opts xlabel(-30(10)10) xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.5)   
	fx2 a_overall2 [pw=wt5], t1(shamed_1v0) t2(shamed_3v0) opts(xline(0, lpattern(dash) lcolor(gs12)) `opts')
	graph export ../Output/Appendix_Figure_35.emf, replace
   graph export ../Output/Appendix_Figure_35.pdf, replace
	
   * Effects of Shaming on Public Approval, by Shamer
	reg a_overall2 i.shamed [pw=wt5] if inlist(shamed,5,6,7,8,9), robust
	margins i.shamed
	margins r.shamed
	matrix fx = r(table)
	coefplot matrix(fx[1,]), ci((fx[5,] fx[6,])) plotregion(style(none)) scheme(s1mono) ///
		mlabel mlabpos(10) format(%3.0f) xlabel(-30(10)0) ///		
		coeflabel(r6vs5.shamed = "Many Countries" r7vs5.shamed = "Allies Only" ///
			r8vs5.shamed = "Non-Allies Only" r9vs5.shamed = "Allies & Non-Allies") ///		
		xline(0, lpattern(dash) lcolor(gs12)) ///
		xtitle("Effect on Approval (%)", margin(t+2)) aspect(.6) scale(1.3)
   graph export ../Output/Appendix_Figure_36.emf, replace
   graph export ../Output/Appendix_Figure_36.pdf, replace
	
}	